/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BO;

import Bean.AccountBean;
import Connection.DBConnect;
import Mapper.DBMapper;
import java.sql.SQLException;
import java.util.*;

/**
 *
 * @author Quang Thao
 */
public class AccountBO {   
    
    public boolean IsTrue(Bean.AccountBean acc) throws Exception
    {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        boolean found = map.IsTrue(acc);
        map.closeConnection();
        return found;
    }
    
    public boolean IsExist(Bean.AccountBean acc) throws Exception
    {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        boolean found = map.IsExist(acc);
        map.closeConnection();
        return found;
    }
    
    public Bean.AccountBean GetInfo(String id) throws Exception
    {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        Bean.AccountBean accBean = map.GetInfo(id);
        map.closeConnection();
        return accBean;
    }
    
    public List GetAll() throws Exception       
    {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        List list = map.GetAll();
        map.closeConnection();
        return list;
    }
    
    public List GetListByType(String type) throws Exception
    {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        List list = map.GetListByType(type);
        map.closeConnection();
        return list;
    }
    
    public int Add(Bean.AccountBean acc) throws Exception
    {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        int update = map.Add(acc);
        map.closeConnection();
        return update;
    }

    public int Delete(AccountBean acc) throws Exception {
        Mapper.AccountMapper map = new Mapper.AccountMapper();
        int update = map.Delete(acc);
        map.closeConnection();
        return update;
    }
}
